package com.cskaoyan.config5;

import com.alibaba.druid.pool.DruidDataSource;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.sql.DataSource;

/**
 * @author stone
 * @date 2022/11/18 15:41
 */
@Configuration
@EnableConfigurationProperties(DataSourceProperties5.class)
public class DataSourceConfiguration5 {


    DataSourceProperties5 properties5;

    public DataSourceConfiguration5(DataSourceProperties5 dataSourceProperties5) {
        this.properties5 = dataSourceProperties5;
    }

    @Bean
    public DataSource dataSource5() {
        DruidDataSource dataSource = new DruidDataSource();
        dataSource.setDriverClassName(properties5.getDriverClassName());
        dataSource.setUrl(properties5.getUrl());
        dataSource.setUsername(properties5.getUsername());
        dataSource.setPassword(properties5.getPassword());
        return dataSource;
    }

}
